<?php
/**
 * Created by PhpStorm.
 * User: 76683
 * Date: 2018/7/21
 * Time: 0:16
 */

namespace app\sd\model;


use think\Model;

class WeDayTopic extends Model
{
    protected $autoWriteTimestamp = true;

    public static function topicList($map)
    {
        $field = 'dt.id,dt.create_time,dt.update_time,t.content,t.photos,t.likes,c.name as category_name';
        $model = new self();
        $data_list = $model->alias('dt')
            ->field($field)
            ->join('__WE_TOPIC__ t', 't.id = dt.topic_id')
            ->join('__WE_CATEGORY__ c', 't.category_id = c.id')
            ->where($map)
            ->paginate(20);
        return $data_list;
    }
}